package com.myapp.imp.war.logical;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.myapp.Logical.interfaces.ILogical;
import com.myapp.data.global.Manages;
import com.myapp.imp.war.msg.CGLifebloodUpdateMsg;
import com.myapp.imp.war.msg.GCLifebloodUpdateMsg;
import com.myapp.msg.base.BaseMsg;
import com.myapp.user.UserBean;

/**
 * 文件名：CGLifebloodUpdateLogical.java
 * <p>
 * 功能：玩家血变化，消息名：CGLifebloodUpdate,权限：AUTHORIZE
 * <p>
 * 版本：1.0.0
 * <p>
 * 作者：Builderd by AppTools
 * <p>
 */
public class CGLifebloodUpdateLogical implements ILogical {

	@Override
	public List<BaseMsg> doLogical(UserBean userBean, BaseMsg msg)
			throws IOException {
		List<BaseMsg> back = new ArrayList<BaseMsg>();
		// 玩家血变化
		if (msg instanceof CGLifebloodUpdateMsg) {
			CGLifebloodUpdateMsg tmp = (CGLifebloodUpdateMsg) msg;
			int feedback = Manages.warManage.lifebloodUpdate(userBean.getId(),
					tmp.getValue());
			// 消息反馈
			GCLifebloodUpdateMsg gcLifebloodUpdateMsg = new GCLifebloodUpdateMsg();
			gcLifebloodUpdateMsg.setFeedback(feedback);
			back.add(gcLifebloodUpdateMsg);
		}
		return back;
	}
}
